package com.erp.excption;


import com.erp.vo.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
@Slf4j
public class CustomException extends RuntimeException{
    @ExceptionHandler(Exception.class)
    @ResponseBody
    public Result exception(AppHttpCodeEnum e){
        log.error("错误问题:{}",e.getErrorMessage());
        return Result.ERROR("出错了",e.getErrorMessage());
    }
}
